package com.testdemo.web.service;

import java.util.List;  
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.testdemo.web.dao.QuestionDao; 
import com.testdemo.web.vo.Question;
import com.testdemo.web.vo.QuestionTypeCount;
@Service 
public class QuestionServiceImpl implements QuestionService {

	 @Autowired  
	    private QuestionDao questionDao;   
	@Override
	public int deleteQuestion(int id) {
		return questionDao.delete(id); 
	}

	@Override
	public int insertQuestion(Question question) { 
		  questionDao.insert(question);
		  return 0;
	}

	@Override
	public List<Question> listQuestion(int userid, int typeid) {
		 
		return questionDao.list(userid, typeid);
	}

	@Override
	public List<QuestionTypeCount> countQuestion(int userid, int typeid) {
		return questionDao.listQuestionsCount(userid, typeid);
	}

	@Override
	public List<QuestionTypeCount> countQuestion(int userid) {
		return questionDao.listQuestionsCount(userid, null);
	}

	@Override
	public List<Question> listQuestion(int userid ) {
		return questionDao.list(userid, null);
	} 

}
